<template>
	<view class="">
		<!-- 微信通用码 start-->
		<view class="li-bg-f has-pdlr-20 has-mgb-3">
			<navigator url="./wxpay_list">
			<view class="has-floatl">
				<image src="../../static/img/common/wx_ico.png" mode=""></image>
				<text class="has-mgl-10">微信通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_wx}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 微信通用码 end-->
		<!-- 支付宝通用码 start-->
		<view class="li-bg-f has-pdlr-20">
			<navigator url="./alipay_list">
			<view class="has-floatl">
				<image src="../../static/img/common/zfb_ico.png" mode=""></image>
				<text class="has-mgl-10">支付宝通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_alipay}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 支付宝通用码 start-->
		<!-- QQ钱包通用码 start-->
		<view class="li-bg-f has-pdlr-20">
			<navigator url="./qq_list">
			<view class="has-floatl">
				<image src="../../static/img/common/qq_ico.png" mode=""></image>
				<text class="has-mgl-10">QQ钱包通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_qq}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- QQ钱包通用码 start-->
		<!-- 银联通用码 start-->
		<view class="li-bg-f has-pdlr-20">
			<navigator url="./bank_list">
			<view class="has-floatl">
				<image src="../../static/img/common/bank_ico.png" mode=""></image>
				<text class="has-mgl-10">银联云闪付通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_bank}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 银联通用码 start-->
		<view>
		    <show-modal></show-modal>
		</view>
	</view>
</template>

<script>
	var _self;
	export default {
		data() {
			return {
				userinfo:[],
				fox_money_can:0,
				fox_user_jihuo:0,
				ma_lock:0,
				ma_wx:0,
				ma_alipay:0,
				ma_qq:0,
				ma_bank:0
			}
		},
		onLoad() {	
			_self = this;
			let info = this.service.getfox();
			if(info[0]){
				// console.log(info[0])				
				this.foxtoken = info[0]['foxtoken'];
				// uni.clearStorageSync();
				uni.request({
					url: this.service.FOX_URL + 'diamond/get_userinfo_ma',
					method:'POST',
					data: {
						user_key: this.foxtoken
					},
					dataType:'json',
					header:{
						'content-type':'application/x-www-form-urlencoded',
					},
					success: res => {
						// var rest = JSON.stringify(res);
						// console.log(res)
						var rest = res.data;
						if(rest.status == 'success'){
							this.userinfo = rest.msg;
							this.ma_lock = this.userinfo['ma_lock'];
							this.ma_wx = this.userinfo['ma']['wxma'];
							this.ma_alipay = this.userinfo['ma']['alima'];
							this.ma_qq = this.userinfo['ma']['qqma'];
							this.ma_bank = this.userinfo['ma']['bankma'];
							this.fox_money_can = this.userinfo['diamondset']['diamond_money_can'];
							this.fox_user_jihuo = this.userinfo['diamondset']['diamond_user_jihuo'];
							if(this.ma_lock == 0){
								this.jihuo()
							}
							// console.log(this.userinfo)
						}else if(rest.status == 'error'){
							uni.clearStorageSync();
							uni.showToast({
								title:rest.msg,
								icon:'none',
								mask:true
							})
							setTimeout(function() {
							    uni.reLaunch({
							    	url:'../logon/login'
							    })
							}, 1500)
						}else{
							uni.clearStorageSync();
							uni.showToast({
								title:rest.msg,
								icon:'none',
								mask:true
							})
							setTimeout(function() {
							    uni.reLaunch({
							    	url:'../logon/login'
							    })
							}, 1500)
						}
					}
				})
			}else{
				uni.reLaunch({
					url:'../logon/login'
				})
			}
		},
		methods:{
			jihuo(){
				this.$showModal({
				    title: '提示',
				    content: '激活帐号需扣除'+this.fox_user_jihuo+'DC，激活成功可进行接单',
					cancelText:'拒绝',
					confirmText:'同意',
				    success: function (res) {
				        if (res.confirm) {
				            uni.request({
				            	url: _self.service.FOX_URL + 'diamond/jihuo_user',
				            	method:'POST',
				            	data: {
				            		user_key: _self.foxtoken
				            	},
				            	dataType:'json',
				            	header:{
				            		'content-type':'application/x-www-form-urlencoded',
				            	},
				            	success: res => {
				            		// var rest = JSON.stringify(res);
				            		// console.log(res)
				            		var rest = res.data;
				            		if(rest.status == 'success'){
				            			uni.showToast({
				            				title:rest.msg,
				            				icon:'none',
				            				mask:true
				            			})
				            			setTimeout(function() {
				            			    uni.navigateTo({
				            			    	url:'/pages/index/index'
				            			    })
				            			}, 1500)
				            		}else{
				            			uni.showToast({
				            				title:rest.msg,
				            				icon:'none',
				            				mask:true
				            			})
										setTimeout(function() {
										    uni.navigateTo({
										    	url:'/pages/index/index'
										    })
										}, 1500)
				            		}
				            	}
				            })
				        } else if (res.cancel) {
							uni.navigateBack()
						}
				    }
				});
			}
		}
	}
</script>

<style>
	.li-bg-f{
		background: #FFFFFF;
		height: 120rpx;
		line-height: 120rpx;
	}
	.li-bg-f image{
		width:40rpx;
		height: 40rpx ;
		vertical-align: middle;
	}
</style>
